package com.wzn.mq.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.wzn.mq.component.HelloSender1;
import com.wzn.mq.component.UserSender;
import com.wzn.mq.component.callback.CallBackSender;
import com.wzn.mq.component.fanout.exchange.FanoutSender;
import com.wzn.mq.component.topic.exchange.TopicExchangeSender;

@RestController
@RequestMapping("/rabbit")
public class RabbitTestController {
	@Autowired
	private HelloSender1 helloSender1;
	@Autowired
	private UserSender userSender;
	@Autowired
	private TopicExchangeSender topicExchageSender;
	@Autowired
	private FanoutSender fanoutSender;
	@Autowired
	private CallBackSender callBackSender;

	@PostMapping("/hello")
	public void hello() {
		helloSender1.send();
	}

	@PostMapping("/oneToMany")
	public void oneToMany() {
		for (int i = 0; i < 20; i++) {
			helloSender1.send();
		}
	}

	@PostMapping("/testUser")
	public void testUser() {
		userSender.send();
	}

	@PostMapping("/topicTest")
	public void topicTest() {
		topicExchageSender.send();
	}

	@PostMapping("/fanoutTest")
	public void fanoutTest() {
		fanoutSender.send();
	}

	@PostMapping("/callback")
	public void callback() {
		callBackSender.send();
	}
}
